<div id="actionbar">
    <form id="form" action="{:url('mchid/selectmchid')}" method="get">
        <input type="hidden" name="input" value="{$input}" />
        <input placeholder="请输入商户简称关键字" class="input w200" type="text" name="keyword" value="{$keyword}" />
        <input type="submit" value="搜索" class="button button-blue" />
    </form>
</div>
<table class="table">
    <thead>
        <tr>
            <th class="w50 fn-tac">#</th>
            <th class="w120 fn-tac">微信商户号</th>
            <th class="w280">商户简称</th>
            <th>门店地址</th>
            <th class="w120">手机号</th>
            <th class="w70 fn-tac">默认</th>
            <th class="w70 fn-tac">类型</th>
        </tr>
    </thead>
    <tbody>
        {foreach $lists as $vo}
        <tr>
            <tr>
                <td class="fn-tac">{$vo.id}</td>
                <td class="fn-tac">
                    <a href="javascript:;" class="selectid badge bg-blue" title="选择" data-id="{if $types}{$vo.mchid}{else}{if $input == 'miniapp_uid'}{$vo.miniapp_uid}{elseif $input == 'official_uid' /}{$vo.official_uid}{else}{$vo.id}{/if}{/if}">{$vo.mchid}</a>
                </td>
                <td>{$vo.merchant_shortname}</td>
                <td>{$vo.store_street}</td>
                <td>{$vo.contact_phone}</td>
                <td class="fn-tac">{if $vo.is_default}<span class="badge bg-red">默认</span>{else}<span class="badge">正常</span>{/if}</td>
                <td class="fn-tac">{if $vo.is_types}<span class="badge bg-green">小微</span>{else}<span class="badge">普通</span>{/if}</td>
            </tr>
            {/foreach}
    </tbody>
</table>
<script type="text/javascript">
    Do('base','layer',function(){
        var index = parent.layer.getFrameIndex(window.name);
        $('.selectid').click(function(){
            var user_id = $(this).attr('data-id');
            $.getJSON("{:url('store/isStoreManage')}",{'user_id':user_id},function(rel){
               if(rel.code == 0){
                parent.layer.alert(rel.msg)
               }
                parent.$("#iframe").contents().find("#{$input}").val(user_id);  
                parent.layer.close(index); 
            });
        });
    })
</script>